import {
	getUser
} from '../service/getData'
import {
	SET_WEIXIN_INFO,
	SET_USER_INFO	
} from './mutation-types.js'

export default {
	async getUserInfo({
		commit,
		state
	}) {
		let res = await getUser();
		if(res.success){
			commit(SET_WEIXIN_INFO, {openId:res.data.wxSmallOpenId,unionid:res.data.wxUnionid});
			commit(SET_USER_INFO,{
				headImg:res.data.headImg,
				nickName:res.data.nickName,
				phone:res.data.phone,
				serviceIng:res.data.serviceIng,
				settleStatus:res.data.settleStatus,
				thirdLoginSuccess:res.data.thirdLoginSuccess,
				uid:res.data.uid,
				token:res.data.token
			});
		}
	},
}